<% layout('/layouts/default.html', {title: '会员卡列表', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text('会员卡列表')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('ztCard:ztCardData:edit')){ %>
					<a href="${ctx}/ztCard/form" class="btn btn-default btnTool" title="${text('会员卡')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${ztCard}" action="${ctx}/ztCard/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">

			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [    

		{header:'${text('会员卡名')}', name:'name', index:'a.name', width:100, align:"center"},
		{header:'${text('图片')}', name:'img', index:'a.img', width:100, align:"center",frozen:true, formatter: function(val, obj, row, act){
			return '<img style="width:43px;height:43px;" src="'+val+'"></img>';
		}},
		{header:'${text('价格')}', name:'price', index:'a.price', width:130, align:"center"},
		{header:'${text('时长')}', name:'monthnum', index:'a.monthnum', width:70, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('zt_card_type')}, val, '${text('1年')}', true);
		}}, 
		{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:190, align:"center"},
		{header:'${text('操作')}', name:'actions', width:100, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('ztCard:ztCardData:edit')){ %>
				
				actions.push('<a href="${ctx}/ztCard/form?id='+row.id+'" class="btnList" title="${text('编辑会员卡')}"><i class="fa fa-pencil"></i></a>&nbsp;');
				
				actions.push('<a href="${ctx}/ztCard/delete?id='+row.id+'" class="btnList" title="${text('删除会员卡')}" data-confirm="${text('确认要删除该会员卡吗？')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
				
			<% } %>
			return actions.join('');
		}}
		
		
		
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>